Skip to content

fix: a dialog's input keeps the keyboard when focus is restored - #1089

Open
darkwebber wants to merge 1 commit into
herdrdev:masterfrom
darkwebber:fix/dialog-keeps-input-focus
Open

darkwebber wants to merge 1 commit into
herdrdev:masterfrom
darkwebber:fix/dialog-keeps-input-focus

Conversation

@darkwebber

Copy link
Copy Markdown

Bug: open a mod dialog whose mod focuses its own Input in init (as the shipped prompt does) from a key binding routed through nextCommand(), then type right away. The first keys go to the terminal under the dialog. The shipped prompt hides this with a 600 ms re-focus timer.

Cause: restore_focus always focuses the topmost dialog's frame handle. So any restore after the mod has focused its input (another overlay closing, the window regaining focus) takes the keyboard off the input.

Fix: if the dialog's frame already contains the focused element, leave focus where it is.

Testing

  • cargo test --locked passes. The repro needs a mod rendered in a live window, so there's no unit test.
  • Checked by hand on macOS: with the fix, a naming prompt opened from a key binding gets the very next key; without it, the first characters land in the shell.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant